package com.xmy.study.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xmy.study.entity.EduCourse;
import com.xmy.study.service.IEduCourseService;
import com.xmy.study.util.Code;
import com.xmy.study.util.PageResult;
import com.xmy.study.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 课程表 前端控制器
 * </p>
 *
 * @author hpiggy
 * @since 2023-09-08
 */
@RestController
@RequestMapping("/api/web/course")
public class CourseController {
    @Autowired
    @Lazy
    IEduCourseService iEduCourseService;

    /**
     * 获取对应班型的课程列表
     * @return
     */
    @GetMapping()
    public Result getCourseList(){
//        Long classTypeId = this.classTypeId;
        QueryWrapper<EduCourse> eduCourseQueryWrapper = new QueryWrapper<>();
//        eduCourseQueryWrapper.eq("class_type_id",classTypeId);
        eduCourseQueryWrapper.eq("status",1);
//        eduCourseQueryWrapper.eq("year_class_id",this.yearClassId);
//        eduCourseQueryWrapper.eq("year_part",this.yearPart);
//        eduCourseQueryWrapper.eq("quarter_num",this.quarterNum);
//        eduCourseQueryWrapper.eq("deleted",0);
        eduCourseQueryWrapper.eq("id","1679402286205370368");

        List<EduCourse> eduCourseList = iEduCourseService.list(eduCourseQueryWrapper);
        return new Result(Code.OK,new PageResult(eduCourseList,(long)eduCourseList.size(),1L));
    }
}
